package com.wss.lsl.test.driven.watermark;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import org.apache.sanselan.ImageReadException;
import org.apache.sanselan.Sanselan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 水印工具
 * 
 * @author sean
 *
 */
public class WatermarkUtil {
	
	private static final Logger LOG = LoggerFactory.getLogger(WatermarkUtil.class);
	
	/**
	 * 使用图片打水印
	 * 
	 * @param markImagePath
	 * 			水印图片
	 * @param sourceImagePath
	 * 			需要打水印的图片
	 * @return
	 */
	public static byte[] markWithImage(String markImagePath, String sourceImagePath){
		
		byte[] destImageData = null;
		
		try {
			File sourceImage = new File(sourceImagePath);
			Dimension dimension = Sanselan.getImageSize(sourceImage);
			int sourceWith = dimension.width;
			int sourceHeight = dimension.height;
			BufferedImage bufferedImage = Sanselan.getBufferedImage(sourceImage);
			Graphics g = bufferedImage.getGraphics();
			
			File markImage = new File(markImagePath);
			
		} catch (Exception e) {
			LOG.error("使用图片打水印发生异常", e);
		}
		
		return destImageData;
	}
}
